<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    给定一个整数表示年份，请判断改年份是不是闰年
    <br>
    （注：闰年是能被4整除但不能被100整除的年，或者能被400整除的年）
    <form action="" method="post">
        请输入年份：<input type="text" name="year">
        <input type="submit" value="提交">
    </form>
    <?php 
      if(!empty($_POST['year'])){
        $year = $_POST['year'];
          if(is_numeric($year)){
              $year2 = (int)$year;
              if($year == $year2){
                if(($year%4==0&&$year%100!=0)||$year%400==0){
                    echo $year.'是闰年';
                }else{
                    echo "{$year}不是闰年";
                }
              }else{
                  echo "年份应该为整数";
              };
            
          }else{
              echo "年份应该为数字";
          };
        
      }else{
          echo "<font color='red'>请输入年份</font>";
      }
      
    ?>
</body>
</html>